<?php
class bullet
{
	public static $table = "bullettype";
	///////////////////////////////////////////
	private $id;
	private $mid;
	private $type;
	private $speed;
	private $range;
	///////////////////////////////////////////
	public function __set($name, $value) //将从数据库中取来的参数设为只读
	{
		if (isset( $this->$name )){}
		else $this->$name = $value;
	}
	
	public function __get($name) 
	{
		if( isset( $this->$name ) ) return $this->$name;
		else trigger_error( $name . ' variables undefined',  E_USER_NOTICE );
	}
	///////////////////////////////////////////
	public function bullet($id)
	{
		$command = "select * from ".bullet::$table." where id=$id";
		$result = mysql::run($command);
		$data=mysql_fetch_array($result);
		
		$this->id = $data["id"];
		$this->mid = $data["mid"];
		$this->type = $data["type"];
		$this->speed = $data["speed"];
		$this->range = $data["range"];
	}
	
}
?>